package com.arpgalaxy.spring.boot.autoconfigure.shiro;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.env.MutablePropertySources;
import org.springframework.core.env.PropertySource;
import org.springframework.core.env.StandardEnvironment;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @author arpgalaxy
 * @date 2021/4/11
 * @email 13605560342@163.com
 * @description
 */
public class ArpgalaxyShiroCondition implements Condition {
    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
        Environment environment = conditionContext.getEnvironment();
        String enabled = environment.getProperty("arpgalaxy.shiro.autoconfigure.enabled");
        if ("true".trim().equals(enabled)){
            return true;
        }else {
            return false;
        }
    }
}
